<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="./jQuery-2.2.0.min.js"></script>
    <title>Document</title>
</head>
<body>
    <script>
        let arr1 = [1,2,5,8,7,9,4,3,10];
        function sort(arr){
            $.each(arr,(index,item)=>{
                console.log(index+ "******" + item)
                for(let j = 0 ; j < arr.length -1 - index; j++){
                    if(arr[j] > arr[j+1]){
                        let flag = arr[j];
                        arr[j] = arr[j+1];
                        arr[j+1] = flag;
                    }
                }
            })
            console.log(arr)
            return arr;
        }
        sort(arr1)
    </script>
</body>
</html>